import base64

def hex_to_base64(hex_str):
    # 将hex字符串转换为字节
    byte_data = bytes.fromhex(hex_str)
    
    # 将字节编码为base64字符串
    base64_str = base64.b64encode(byte_data).decode('utf-8')
    
    return base64_str

# 示例
hex_string = '0f937a28b79e0a3b45672a8f5b07d2f8'
base64_string = hex_to_base64(hex_string)
print(base64_string)
